00001 // LeftTop.cpp : implementation file 00002 // 00003 /* 00004 * This is the view for the toolbox of the software TraffEdu. 00005 * The corresponding form view can be seen in the resources view 00006 * as IDD_LEFTTOP. 00007 * 00008 **/ 00009 00010 #include "stdafx.h" 00011 #include "TraffEdu.h" 00012 #include "LeftTop.h" 00013 #include "MainFrm.h" 00014 #include "RoadForm.h" 00015 #include "LightForm.h" 00016 #include "SignForm.h" 00017 #include "VehicleForm.h" 00018 #include "EnvObjectsForm.h" 00019 #include ".\lefttop.h" 00020 #include "Enumarations.h" 00021 #include "fstream" 00022 00023 00024 // LeftTop 00025 00026 IMPLEMENT_DYNCREATE(LeftTop, CFormView) 00027 00028 LeftTop::LeftTop() 00029 : CFormView(LeftTop::IDD) 00030 { 00031 } 00032 00033 //to access the enumerated variables of MainFrame 00034 DrawMode CMainFrame::drawMode; 00035 DrawMode drawMode; 00036 TrafficSignTypes CMainFrame::signType; 00037 TrafficLightColor CMainFrame::lightColor; 00038 TrafficLightTypes CMainFrame::lightType; 00039 RoadType CMainFrame::roadType; 00040 bool CMainFrame::textureFlag; 00041 LeftTop::~LeftTop() 00042 { 00043 } 00044 00045 void LeftTop::DoDataExchange(CDataExchange* pDX) 00046 { 00047 CFormView::DoDataExchange(pDX); 00048 } 00049 00050 BEGIN_MESSAGE_MAP(LeftTop, CFormView) 00051 ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1) 00052 ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2) 00053 ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3) 00054 ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4) 00055 ON_WM_RBUTTONDOWN() 00056 ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButton5) 00057 END_MESSAGE_MAP() 00058 00059 00060 // LeftTop diagnostics 00061 00062 #ifdef _DEBUG 00063 void LeftTop::AssertValid() const 00064 { 00065 CFormView::AssertValid(); 00066 } 00067 00068 void LeftTop::Dump(CDumpContext& dc) const 00069 { 00070 CFormView::Dump(dc); 00071 } 00072 #endif //_DEBUG 00073 00074 00075 // LeftTop message handlers 00076 00077 //The first button of the LeftTop view is for switching to RoadForm 00078 00079 void LeftTop::OnBnClickedButton1() 00080 { 00081 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent(); 00082 pParentSplitter->ReplaceView(RUNTIME_CLASS(RoadForm)); 00083 ((CMainFrame*)(pParentSplitter->GetParentFrame()))->drawMode=DRAW_ROAD; 00084 ((CMainFrame*)(pParentSplitter->GetParentFrame()))->textureFlag=false; 00085 ((CMainFrame*)(pParentSplitter->GetParentFrame()))->roadType=RELEASE_ROAD;; 00086 00087 } 00088 00089 //The second button of the LeftTop view is for switching to VehicleForm 00090 00091 void LeftTop::OnBnClickedButton2() 00092 { 00093 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent(); 00094 pParentSplitter->ReplaceView(RUNTIME_CLASS(VehicleForm)); 00095 00096 } 00097 00098 00099 00100 //The third button of the LeftTop view is for switching to LightForm 00101 00102 void LeftTop::OnBnClickedButton3() 00103 00104 { 00105 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent(); 00106 pParentSplitter->ReplaceView(RUNTIME_CLASS(LightForm)); 00107 ((CMainFrame*)(pParentSplitter->GetParentFrame()))->drawMode=DRAW_TRAFFIC_LIGHT; 00108 00109 00110 } 00111 00112 //The fourth button of the LeftTop view is for switchin to RoadForm 00113 00114 void LeftTop::OnBnClickedButton4() 00115 { 00116 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent(); 00117 pParentSplitter->ReplaceView(RUNTIME_CLASS(SignForm)); 00118 00119 } 00120 00121 00122 00123 void LeftTop::OnBnClickedButton5() 00124 { 00125 C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent(); 00126 pParentSplitter->ReplaceView(RUNTIME_CLASS(EnvObjectsForm)); 00127 }
1.4.6-NO